//
//  TotalStepsDataModel.swift
//  TimeBoat
//
//  Created by Jun on 2022/9/8.
//  Copyright © 2022 Time Boat. All rights reserved.
//

import Foundation

/// 总步数
@objcMembers class TotalStepsDataModel: NSObject {
    /// 总步数, 4 byte
    var totalStep: UInt32 = 0

    /// 总距离, 4 byte
    var totalDistance: UInt32 = 0

    /// 总卡路里, 4 byte
    var totalCalorie: UInt32 = 0
    
    convenience init(buf: [UInt8]) {
        self.init()
        
        
        if (buf.count >= 12) {
            var index = 0

            totalStep = UInt32.toUInt32(buf: buf, offset: index)
            index += 4

            totalDistance = UInt32.toUInt32(buf: buf, offset: index)
            index += 4

            totalCalorie = UInt32.toUInt32(buf: buf, offset: index)
        }
    }
    
    @objc func toString() -> String {
        var str = self.yy_modelToJSONString()
        if nil == str {
            str = ""
        }
        
        return str!
    }
}
